<template>
    <view class="content">
        <u-navbar :background="background" title="实时在线订单" title-color="#fff" :border-bottom="false" :immersive="true"
            :is-back="false" back-icon-color="#fff">
            <view class="u-p-l-20" @click="back">
                <u-icon name="arrow-left" color="#fff" size="36"></u-icon>
            </view>
        </u-navbar>
        
        <view :style="{marginTop: statusBar + 45 + 'px'}">
            <view class="nav">
                <view class="nav-i" :class="{active : type == 1}" @click="chooseNav(1)">未报名订单</view>
                <view class="nav-i" :class="{active : type == 2}" @click="chooseNav(2)">已报名订单</view>
            </view>
            <view class="line"></view>
            <view class="wrapper">
                <view class="item" v-for="(item, index) in 10" :key="index" 
                    @click="$gTo(`/serve/pages/order/realtime-details?id=${item.id}`)">
                    <image src="/static/del/34.png" class="item-img"></image>
                    <view>
                        <view class="name">美术艺术班美术艺术班美术艺术班美术艺术班美术艺术班美术艺术班</view>
                        <view class="sub">艺术班是一种专门为供的班级教育模式艺术班是一种专门为供的班级教育模式</view>
                        <view class="time">2023-10-12</view>
                        <view class="down" v-if="type == 1">
                            <view class="btn">立即报名</view>
                        </view>
                    </view>
                </view>
            </view>
        </view>
        
        <view class="tabbar">
            <view class="tab" @click="change(1)">
                <image src="../../static/icon/s_tab_02.png" class="s-tab-01" v-if="tab == 1"></image>
                <image src="../../static/icon/s_tab_01.png" class="s-tab-01" v-else></image>
                <view :class="{tabActive : tab == 1}">首页</view>
            </view>
            <view class="tab" @click="change(2)">
                <image src="../../static/icon/s_tab_04.png" class="s-tab-01" v-if="tab == 2"></image>
                <image src="../../static/icon/s_tab_03.png" class="s-tab-01" v-else></image>
                <view :class="{tabActive : tab == 2}">实时</view>
            </view>
            <view class="tab" @click="change(3)">
                <image src="../../static/icon/s_tab_06.png" class="s-tab-01" v-if="tab == 3"></image>
                <image src="../../static/icon/s_tab_05.png" class="s-tab-01" v-else></image>
                <view :class="{tabActive : tab == 3}">社群</view>
            </view>
            <view class="tab" @click="change(4)">
                <image src="../../static/icon/s_tab_08.png" class="s-tab-01" v-if="tab == 4"></image>
                <image src="../../static/icon/s_tab_07.png" class="s-tab-01" v-else></image>
                <view :class="{tabActive : tab == 4}">我的</view>
            </view>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                statusBar: 0,
                background: { backgroundColor: 'rgba(242,151,0,1)' },
                tab: 2, //1首页 2实时 3社群 4我的
                type: 1,
            };
        },
        onLoad() {
            let _this = this;
            //状态栏高度
            uni.getSystemInfo({
            	success: function(res) {
            		_this.statusBar = res.statusBarHeight;
            	}
            });
        },
        methods: {
            chooseNav(num) {
                this.type = num
            },
            
            
            // 切换服务人员底部导航
            change(num) {
                if (num == 1) {
                    this.$cTo(`/serve/pages/tab/home`)
                } else if (num == 2) {
                    return
                    // this.$cTo(`/serve/pages/tab/realtime`)
                } else if (num == 3) {
                    this.$cTo(`/serve/pages/tab/friends`)
                } else if (num == 4) {
                    this.$cTo(`/serve/pages/tab/us`)
                }
            },
            
            back() {
                uni.switchTab({
                    url: '/pages/tabbar/mine'
                })
            },
            
            onPageScroll: function(e) {
            	//nvue暂不支持滚动监听，可用bindingx代替
            	// console.log("滚动距离为：" + e.scrollTop);
            	let a = e.scrollTop * 0.05;
            	if (a > 1) {
            		a = 1;
            	}
                this.background.backgroundColor = 'rgba(242,151,0,1)';
            	// if (e.scrollTop == 0) {
            	// 	this.background.backgroundColor = 'rgba(0,0,0,0)';
            	// } else {
            	// 	this.background.backgroundColor = 'rgba(0,0,0,' + a + ')';
            	// }
            },
        }
    };
</script>

<style lang="scss">
    page{
        background-color: #fff;
    }
    .content{
        padding-bottom: 120rpx;
    }
    .tabbar{
        width: 100vw;
        height: 115rpx;
        background-color: #fff;
        border-top: 2rpx solid #e6e6e6;
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 999;
    }
    .tab{
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-size: 24rpx;
    }
    .s-tab-01{
        width: 50rpx;
        height: 50rpx;
    }
    .tabActive{
        color: #f29700;
    }
    
    
    .nav{
        display: flex;
        justify-content: space-between;
        align-items: center;
        background-color: #fff;
    }
    .nav-i{
        width: calc(100vw / 2);
        padding: 30rpx 0;
        font-size: 28rpx;
        text-align: center;
    }
    .active{
        font-size: 32rpx;
        color: #f29700;
        border-bottom: 2rpx solid #f29700;
    }
    .line{
        width: 100vw;
        height: 20rpx;
        background-color: #f5f5f5;
    }
    .wrapper{
        padding: 20rpx 30rpx;
    }
    .item{
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 30rpx 0;
    }
    .item-img{
        width: 165rpx;
        height: 165rpx;
        border-radius: 10rpx;
        margin-right: 20rpx;
    }
    .name{
        width: 500rpx;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 32rpx;
        font-weight: bold;
        padding-bottom: 20rpx;
    }
    .sub{
        font-size: 24rpx;
        color: #949494;
        width: 500rpx;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .time{
        font-size: 24rpx;
        color: #949494;
    }
    .down{
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }
    .btn{
        font-size: 25rpx;
        color: #fff;
        padding: 15rpx 23rpx;
        background-color: #f29700;
        border-radius: 10rpx;
    }
    
    

</style>
